// pages/my/kefu/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    haibao:'',
      wenti:'',
      phone:'',
      id:0,
      info:{}
  },

    getDataList:function(e){
    var that = this;
        wx.request({
            url: getApp().data.server+'/index.php/Tongcheng/Book/getHaiBao?id='+that.data.id,
            success:function(d){
              if(0 != d){
                that.setData({
                    haibao:d.data.kefu_haibao,
                    info:d.data.info
                })
              }
            }
        })
    },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      console.log(options)
      if('undefiend' != options.id && 0 != options.id){
          this.setData({
              id:options.id
          })
      }

    this.getDataList();
  },
    bindinput:function(e){
      var name = e.currentTarget.dataset.name;
      var that = this;
      switch (name){
          case 'wenti':
            that.setData({
                wenti:e.detail.value
            })
            break;
          case 'phone':
              that.setData({
                  phone:e.detail.value
              })
              break;
      }
    },
    formSubmit:function(d){
    var that = this;
        wx.request({
            url: getApp().data.server+'/index.php/Tongcheng/Book/saveFanKui',
            data:{'wenti':that.data.wenti,'phone':that.data.phone,'uid':getApp().globalData.userInfo.uid},
            success:function(d){
                if(0 == d.data){
                    wx.showToast({
                        title:'提交失败',
                        icon: 'success',
                        duration: 2000
                    })
                }else{
                    wx.showToast({
                        title:'提交成功',
                        icon: 'success',
                        duration: 2000
                    })
                }
                setTimeout(function(){
                    wx.navigateBack();
                },1000)
            }
        })
    },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})